﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Caliburn.Micro.BikeWizard.Services;
using Caliburn.Micro.BikeWizard.Data;
using System.Collections.Generic;

namespace Caliburn.Micro.BikeWizard.Utils
{
    /// <summary>
    /// Helps with setting up testdata
    /// </summary>
    public class TestDataHelper
    {
        #region Public Methods
        public IResult SetupTestData(IBikeOptionService bikeOptionService)
        {
            return 
                new CoroutineExecutor(
                    SetupBikeTypes(bikeOptionService),
                    SetupFrameSizes(bikeOptionService),
                    SetupPartsGroups(bikeOptionService),
                    SetupExtras(bikeOptionService));
        }
        #endregion

        #region Private Methods
        private IResult SetupBikeTypes(IBikeOptionService bikeOptionService)
        {
            return bikeOptionService.Add(
                new BikeTypeOption() { DisplayName = "Hardtail MTB", Price = 999.99m, SortOrder = 1, IsDefault = true },
                new BikeTypeOption() { DisplayName = "Full suspension MTB", SortOrder = 4, Price = 1999.99m },
                new BikeTypeOption() { DisplayName = "Race Bike", SortOrder = 2, Price = 1259.99m },
                new BikeTypeOption() { DisplayName = "City Bike", SortOrder = 0, Price = 499.99m },
                new BikeTypeOption() { DisplayName = "Trekking Bike", SortOrder = 3, Price = 1499.99m });
        }

        private IResult SetupFrameSizes(IBikeOptionService bikeOptionService)
        {
            return bikeOptionService.Add(
                new FrameSizeOption() { DisplayName = "Small", Price = .00m, SortOrder = 0 },
                new FrameSizeOption() { DisplayName = "Medium", Price = 299.99m, SortOrder = 1 },
                new FrameSizeOption() { DisplayName = "Large", Price = 399.99m, SortOrder = 2 });
        }

        private IResult SetupPartsGroups(IBikeOptionService bikeOptionService)
        {
            return bikeOptionService.Add(
                new PartsGroupOption() { DisplayName = "Shimano XT", Price = 0m, SortOrder = 0, IsDefault = true },
                new PartsGroupOption() { DisplayName = "Shimano XTR", Price = 599.99m, SortOrder = 1 },
                new PartsGroupOption() { DisplayName = "Sram X0", Price = 449.99m, SortOrder = 2 });
        }

        private IResult SetupExtras(IBikeOptionService bikeOptionService)
        {
            return bikeOptionService.Add(
                new ExtrasOption() { DisplayName = "Bar ends", Price = 29.99m, SortOrder = 0 },
                new ExtrasOption() { DisplayName = "Pump", Price = 19.29m, SortOrder = 1 },
                new ExtrasOption() { DisplayName = "Pedals", Price = 119.99m, SortOrder = 2 },
                new ExtrasOption() { DisplayName = "Bike Shirt", Price = 49.99m, SortOrder = 3 },
                new ExtrasOption() { DisplayName = "Bike Trousers", Price = 29.99m, SortOrder = 4, IsDefault = true },
                new ExtrasOption() { DisplayName = "Rain Jacket", Price = 59.99m, SortOrder = 5, IsDefault = true });
        }
        #endregion
    }
}
